package com.aquan.map_jetpack.ui.screens


import androidx.compose.foundation.layout.Column
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import com.airbnb.lottie.compose.*
import com.aquan.map_jetpack.ui.components.Loading
import com.aquan.map_jetpack.ui.components.TopAppBar
import kotlinx.coroutines.launch

@Composable
fun DetailsScreen(backTo: () -> Unit = {}) {

    var status by remember {
        mutableStateOf(false)
    }

    Column() {
        TopAppBar() {
            Text(text = "新闻详情", color = Color(0xFFFFFFFF))
        }
        Button(onClick = {
            status = !status
        }) {
            Text(text = "动画加载")
        }
        Text(text = "数据详情")

        Button(onClick = {
            backTo.invoke()
        }) {
            Text(text = "返回")
        }

    }

    if (status) {
        Loading()
    } else {
        null
    }
}

@Preview
@Composable
fun DetailsScreenPreview() {
    DetailsScreen()
}

